<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ting Manager</title>
    <link href="/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="/">Ting</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="/course">课程</a></li>
                <li><a href="/upload">上传文件</a></li>
                <li><a href="/user">用户管理</a></li>
                <li><a href="/comment">评论</a></li>
            </ul>
        </div>
    </div>
</nav>
<div class="panel panel-default">
    <div class="panel-heading">
        <%= course.title %>
        <span style="margin-left: 10px" class="label label-success">
            <%= course.author %>
        </span>
    </div>
    <div class="panel-body">
        <address>
            <strong>发布时间: <%= course.publish.toLocaleString() %></strong><br>
            <strong>状态: <span class="label <%= course.putIn ? 'label-info' : 'label-danger' %>"><%= course.putIn ? '上架ing' : '已下架' %></span></strong>
        </address>
        <p><%= course.description %></p>
    </div>
    <table class="table table-striped table-hover table-condensed">
        <thead>
        <tr>
            <th>标题</th>
            <th>时长</th>
            <th>音频key</th>
            <th>附件key</th>
            <th>发布时间</th>
        </tr>
        </thead>
        <tbody>
        <% for(var i = 0, voice;voice = voices[i++];){ %>
        <tr>
            <td><%= voice.title %></td>
            <td><%= voice.duration || '空' %></td>
            <td><%= voice.voice || '无' %></td>
            <td><%= voice.manuscripts || '无' %></td>
            <td><%= voice.publishTime.toLocaleString() %></td>
        </tr>
        <% } %>
        </tbody>
    </table>
</div>
<div class="panel panel-default">
    <div class="panel-heading">
        <h2 class="panel-title" style="margin-left: 20px">添加音频</h2>
    </div>
    <div class="panel-body">
        <form class="form-horizontal" method="post" action="/course/<%= course._id %>/voice">
            <div class="form-group">
                <label for="title" class="col-sm-2 control-label">标题:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="title" name="title" placeholder="这期的音频标题">
                </div>
            </div>
            <div class="form-group">
                <label for="duration" class="col-sm-2 control-label">时长:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="duration" name="duration" placeholder="音频时长(s)">
                </div>
            </div>
            <div class="form-group">
                <label for="voiceKey" class="col-sm-2 control-label">音频源:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="voiceKey" name="voice" placeholder="音频Key(可以不填)">
                </div>
            </div>
            <div class="form-group">
                <label for="manuscriptsKey" class="col-sm-2 control-label">文稿附件:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="manuscriptsKey" name="manuscripts" placeholder="附件Key(可以不填)">
                </div>
            </div>
            <div class="form-group" style="display: none;">
                <label for="course" class="col-sm-2 control-label">课程Id:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="course" name="course" value="<%= course._id %>">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default">添加</button>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script src="/js/jquery.js"></script>
<script src="/js/bootstrap.js"></script>
</html>